<template>
  <el-drawer v-model="drawer" title="产品预览" custom-class="drawers" size="32%">
    <div class="activity-phone">
      <ActivityPhone :productPopupData="productPopupData" />
    </div>
    <div class="product_box scroll" v-if="false">
      <div class="mobile_box">
        <div class="white_box">
          <div class="title_box">
            <el-icon><ArrowLeftBold /></el-icon>
            <h3 class="title_r">产品详情</h3>
          </div>
          <div class="product_pic">
            <el-image class="img_right" :src="productPopupData?.images" style="width: 100%">
              <template #error>
                <el-image src="/static/file/pic.png" style="width: 100%"></el-image>
              </template>
            </el-image>
          </div>
          <div style="padding: 0 10px">
            <div class="product_information">
              <div>{{ productPopupData?.product_name }}</div>
              <div class="Price">
                <span>售价：{{ productPopupData.sale_price ? productPopupData.sale_price : productPopupData?.specificate_list[0]?.sale_price }}</span>
                <span>当前规格库存：{{ productPopupData.stock_qty ? productPopupData.stock_qty : productPopupData?.specificate_list[0]?.stock_qty }}</span>
              </div>
              <div class="specs_box">
                <div v-if="productPopupData.specificate_list.length !== 0" class="specs_rule">选择规格：</div>
                <div v-for="(item, index) in productPopupData.specificate_list" :key="item.id">
                  <span :class="['specs_text', index == 0 ? 'active' : '']">{{ item.options_vals }}</span>
                </div>
              </div>
            </div>
          </div>
          <div style="padding: 0 10px">
            <div class="product_describe">
              <span class="describe">产品描述</span>
              <div class="describe_text">
                {{ productPopupData?.product_desc }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </el-drawer>
</template>
<script setup lang="ts">
  import ActivityPhone from '@/components/zw/phonePreview/activityPhonePreview/productmanagement/index.vue'
  import { ref } from 'vue'
  defineProps(['productPopupData'])
  let drawer = ref(false)
  defineExpose({ drawer })
</script>
<style lang="scss" scoped>
  .activity-phone {
    margin: 40px;
  }
  .slot {
    border-bottom: 1px solid #eaeaea;
    margin: -32px -16px 0;
  }
  .product_box {
    .mobile_box {
      box-sizing: content-box;
      width: 414px;
      padding: 16px;
      border-radius: 25px;
      border: 1px solid #d2d8db;
      background-color: #f3fafb;
      margin: 0 auto;
      margin-top: 40px;
      .white_box {
        width: 100%;
        background-color: #fff;
      }
      .title_box {
        display: flex;
        align-items: center;
        height: 44px;
        padding-left: 11px;
        background: #29a9f5;
        border-radius: 15px 15px 0px 0px;
        color: #fff;
        .title_r {
          flex: 1;
          text-align: center;
        }
      }
      .product_pic {
        display: flex;
        justify-content: center;
      }
      .product_information {
        margin-top: 16px;
        min-height: 65px;
        background: #ffffff;
        box-shadow: 0px 6px 10px 0px rgba(46, 91, 255, 0.07);
        border-radius: 8px;
        border: 1px solid #eff2ff;
        padding: 16px 12px 0;
        color: #282828;
        font-weight: 550;
        font-size: 18px;
        .Price {
          display: flex;
          justify-content: space-between;
          align-items: center;
          color: #969696;
          font-size: 14px;
          margin-top: 16px;
        }
        .specs_box {
          display: flex;
          flex-wrap: wrap;
          margin-top: 20px;
          .specs_rule {
            font-size: 14px;
            color: #969696;
            line-height: 29px;
          }
          .specs_text {
            min-width: 85px;
            height: 26px;
            background: #f7f7f7;
            border-radius: 6px;
            border: 1px solid #e3e3e3;
            font-size: 14px;
            color: #969696;
            margin: 0 12px 12px 0;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 0 5px;
          }
          .active {
            background: #eff2ff;
            color: #0081ff;
          }
        }
      }
      .product_describe {
        margin-top: 16px;
        min-height: 100px;
        background: #ffffff;
        box-shadow: 0px 6px 10px 0px rgba(46, 91, 255, 0.07);
        border-radius: 8px;
        border: 1px solid #eff2ff;
        padding: 16px 12px 0;
        word-break: break-all;
        .describe {
          color: #282828;
          font-weight: 550;
          font-size: 18px;
        }
        .describe_text {
          margin-top: 13px;
          line-height: 20px;
          color: #969696;
          font-size: 14px;
        }
      }
    }
  }
</style>
